#region Using References

using System;
using System.Collections;
using System.Linq;
using Beaker.OpenCube.Mapping;

#endregion

namespace Beaker.OpenCube.Game.Converters
{
	public sealed class RotationConverter 
		: IValueConverter
	{
		public object FromNbtToLocal( object nbtValue )
		{
			var sequence = nbtValue as IEnumerable;
			if( sequence != null )
			{
				float[] values = sequence.OfType<float>().ToArray();
				if( values.Length == 2)
				{
					return new Rotation( values[0], values[1] );
				}
			}

			throw new NotSupportedException("Can only convert from 2 floats to rotation");
		}

		public object FromLocalToNbt( object localValue, Type targetType )
		{
			throw new NotImplementedException();
		}
	}
}